package br.com.minhascontas.activity.relatorio;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import br.com.example.minhascontas.R;

public class RelatorioPorPeriodo extends Activity {
	
	private Button btnRelatorioPorPeriodo;
	private DatePicker dtpRelatorioPorPeriodoAte;
	private DatePicker dtpRelatorioPorPeriodoDe;
	private String strAnoDe;
	private String strMesDe;
	private String strDiaDe;
	private String strAnoAte;
	private String strMesAte;
	private String strDiaAte;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.relatorio_por_periodo);
		
		btnRelatorioPorPeriodo = (Button) findViewById(R.id.btnRelatorioPorPeriodo);
		dtpRelatorioPorPeriodoAte = (DatePicker) findViewById(R.id.dtpRelatorioPorPeriodoAte);
		dtpRelatorioPorPeriodoDe = (DatePicker) findViewById(R.id.dtpRelatorioPorPeriodoDe);
		
		btnRelatorioPorPeriodo.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				strAnoAte =  Integer.toString(dtpRelatorioPorPeriodoAte.getYear());
				strMesAte =  Integer.toString(dtpRelatorioPorPeriodoAte.getMonth()+1);
				strDiaAte =  Integer.toString(dtpRelatorioPorPeriodoAte.getDayOfMonth());
				
				strAnoDe =  Integer.toString(dtpRelatorioPorPeriodoDe.getYear());
				strMesDe =  Integer.toString(dtpRelatorioPorPeriodoDe.getMonth()+1);
				strDiaDe =  Integer.toString(dtpRelatorioPorPeriodoDe.getDayOfMonth());
				
				Intent intent = new Intent(RelatorioPorPeriodo.this, ExibirLancamentos.class);
				intent.putExtra("intAnoAte", strAnoAte);
				intent.putExtra("intMesAte", strMesAte);
				intent.putExtra("intDiaAte", strDiaAte);
				intent.putExtra("intAnoDe", strAnoDe);
				intent.putExtra("intMesDe", strMesDe);
				intent.putExtra("intDiaDe", strDiaDe);
				startActivity(intent);
			}
		});
	}

}
